<!--
 * @Author: chunlai
 * @Date: 2024-03-07 10:23:21
 * @LastEditTime: 2025-09-04 19:03:11
 * @LastEditors: minsheng_insurance_agency_zhoucl
 * @FilePath: \02.bldinsure\src\views\omnipotent\pages\ChangCheng.vue
 * @Description: 长城
-->
<template>
  <div class="page_main" v-if="pageLoad">
    <div class="nair_res_box">
      <p class="nair_md1">您的风险承受能力等级</p>
      <div class="nair_type">{{ testResult.label }}</div>
      <div class="nair_tnamne">{{ testResult.label }}承受程度</div>
      <div class="nair_conts mt14">
        {{ testResult.text }}
      </div>
      <div class="nair_conts">测评有效期：{{ apiData.validityDate }}</div>
    </div>
    <div class="nair_btns_box">
      <div class="btn_box conti_btn" @click="goNextPage">继续投保</div>
      <div class="btn_box retest_btn" @click="goNairAssessPage()">重新评估</div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import { rebackUrlPath } from "@/methods/format.js";
export default {
  name: "ChangChengCusterNair",
  components: {},
  data() {
    return {
      pageLoad: false,
      apiData: {
        hasSurveyInfo: "", //是否有问卷，0无，1有
        sumPoint: "", //总分数
        pointDesc: "", //类型：1-谨慎型，2-稳健型，3-平衡型，4-进取型，5-激进型
        prompt: "",
        validityDate: "", //评测有效期
        url: "",
      },
    };
  },
  computed: {
    ...mapGetters({
      testResult: "fengxian/testResult",
    }),
  },
  watch: {},
  created() {
    this.pageLoad = false;
    this.getNairLinkAddr();
  },
  mounted() {},
  methods: {
    getNairLinkAddr(type = "") {
      let params = {
        ...this.apiComParams,
        backUrl: "",
      };
      const urlValue = `#/form`;
      params.backUrl = `${rebackUrlPath(urlValue)}`;
      this.$store
        .dispatch("apis/comAdminApiRequest", {
          apiParams: params,
          apiName: "querySurvey",
          toast: true,
        })
        .then((data) => {
          if (type === "reset" && data.url) {
            window.location.href = data.url;
            return;
          }
          if (data.hasSurveyInfo == "1") {
            this.pageLoad = true;
            Object.assign(this.apiData, data);
            this.$store.dispatch("fengxian/getResObj", data.pointDesc);
          } else {
            window.location.href = data.url;
          }
        });
    },
    goNairAssessPage() {
      if (this.apiData.url) {
        window.location.href = this.apiData.url;
      } else {
        this.getNairLinkAddr("reset");
      }
    },
    goNextPage() {
      this.$router.push("/form");
    },
  },
};
</script>
<style lang="less" scoped>
.page_main {
  padding: 80px 20px 0;
  .nair_res_box {
    background-color: #fff;
    padding: 9px 14px;
    border-radius: 14px;
    border: 1px solid #999;
    .nair_md1 {
      text-align: center;
      padding-top: 9px;
      font-size: 15px;
      line-height: 1.8;
    }
    .nair_type {
      height: 96px;
      color: rgb(164, 0, 1);
      text-align: center;
      line-height: 96px;
      font-size: 26px;
    }
    .nair_tnamne {
      text-align: center;
      font-size: 16px;
      line-height: 1.8;
    }
    .nair_conts {
      font-size: 13px;
      line-height: 1.8;
    }
  }
  .nair_btns_box {
    padding-top: 190px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    .btn_box {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 45%;
      height: 40px;
      line-height: 1;
      border-radius: 5px;
      &.retest_btn {
        color: #fff;
        -webkit-tap-highlight-color: transparent;
        background: linear-gradient(rgb(222, 39, 40) 0%, rgb(164, 0, 1) 100%);
      }
      &.conti_btn {
        color: rgb(164, 0, 1);
        border: 1px solid rgb(164, 0, 1);
        background-color: #fff;
      }
    }
  }
}
</style>
